<#include "../base/basic-page.ftl">
<#include "../common/table.ftl">
<#include "../common/modal.ftl">
<#include "../common/form.ftl">
<@page_head>

</@page_head>
<@page_body page_title="分组管理" side_active="/admin/goods/group">
    <div class="main-content container-fluid">
        <div class="row">
            <!--Responsive table-->
            <div class="col-sm-12">
                <@table_wrap "分组列表">
                <@table_tools>
                    <button class="btn btn-space btn-primary"
                            data-toggle="modal"
                            data-target="#model-groups-new">
                        新增分组
                    </button>
                    <button class="btn btn-space btn-danger"
                            data-toggle="modal"
                            data-target="#md-del-user">
                        删除选中
                    </button>
                </@table_tools>
                <@table extra="table-striped table-hover">
                    <@table_head>
                        <th style="width:5%;">
                            <label class="custom-control custom-control-sm custom-checkbox">
                                <input type="checkbox" class="custom-control-input">
                                <span class="custom-control-label"></span>
                            </label>
                        </th>
                        <th style="width:15%;">分组名称</th>
                        <th style="width:30%;">分组描述</th>
                        <th style="width:10%;">商品数量</th>
                        <th style="width:20%;">创建时间</th>
                        <th style="width:25%;">操作</th>
                    </@table_head>
                    <@table_body>
                    <#list pageData.records as item>
                        <tr>
                            <td>
                                <label class="custom-control custom-control-sm custom-checkbox">
                                    <input type="checkbox" class="custom-control-input">
                                    <span class="custom-control-label"></span>
                                </label>
                            </td>
                            <td>
                                ${item.groupName}
                            </td>
                            <td>
                                ${(item.describes)!0}
                            </td>
                            <td>
                                ${(item.goodsCount)!0}
                            </td>
                            <td>
                                2018年11月06日 24:24
                            </td>
                            <td>
                                <button class="btn btn-rounded btn-space btn-success"
                                        data-toggle="modal"
                                        data-target="#model-groups-update-${item.id}">
                                    <i class="icon mdi mdi-border-color"></i>
                                    配置
                                </button>
                                <button id="del-group-${item.id}" class="btn btn-rounded btn-space btn-danger del-group">
                                    <i class="icon mdi mdi-delete"></i>
                                    删除
                                </button>
                            </td>
                        </tr>
                    </#list>
                    </@table_body>
                </@table>
                <@table_footer status="当前显示第&nbsp;${pageData.current}&nbsp页。一共&nbsp;${pageData.totalPage}&nbsp;页">
                    <#if pageData.hasPrevious>
                        <li class="paginate_button page-item previous"
                            id="table1_previous">
                            <a href="?pageNo=${pageData.current-1}" aria-controls="table1" data-dt-idx="0" tabindex="0"
                               class="page-link">
                                上一页
                            </a>
                        </li>
                    </#if>
                    <#if pageData.hasNext>
                        <li class="paginate_button page-item next" id="table1_next">
                            <a href="?pageNo=${pageData.current+1}"
                               aria-controls="table1"
                               data-dt-idx="7"
                               tabindex="0"
                               class="page-link">
                                下一页
                            </a>
                        </li>
                    </#if>
                </@table_footer>
                </@table_wrap>
            </div>
        </div>
    </div>
    <@modal id='model-groups-new'>
        <@modal_header title="新增分组">

        </@modal_header>
        <@formNovalidate id='form-groups-add' class=''>
            <@modal_body>
        <div class="form-group">
            <label for="group-name">分组名称</label>
            <input class="form-control form-control-xs"
                   id="group-name" name="groupName"
                   autocomplete="off" type="text"
                   required data-parsley-error-message="请输入分组名称"
                   placeholder="请输入分组名称">
        </div>
    <div class="form-group">
        <label for="group-des">分组描述</label>
        <input class="form-control form-control-xs"
               id="group-des" name="describes"
               autocomplete="off" type="text"
               placeholder="请输入分组描述">
    </div>
            </@modal_body>
            <@modal_footer>
        <button class="btn btn-secondary md-close" type="button" data-dismiss="modal">取消</button>
        <button class="btn btn-primary md-close" type="submit">确认</button>
            </@modal_footer>
        </@formNovalidate>
    </@modal>
    <#list pageData.records as item>
        <@modal id='model-groups-update-${item.id}'>
            <@modal_header title="编辑分组">

            </@modal_header>
            <@formNovalidate id='form-groups-update-${item.id}' class='form-groups-update'>
                <@modal_body>
                <input name="id" value="${item.id}" style="opacity: 0;display: none;">
        <div class="form-group">
            <label for="group-name">分组名称</label>
            <input class="form-control form-control-xs"
                   id="group-name" name="groupName"
                   autocomplete="off" type="text"
                   value="${item.groupName}"
                   required data-parsley-error-message="请输入分组名称"
                   placeholder="请输入分组名称">
        </div>
    <div class="form-group">
        <label for="group-des">分组描述</label>
        <input class="form-control form-control-xs"
               id="group-des" name="describes"
               value="${item.describes}"
               autocomplete="off" type="text"
               placeholder="请输入分组描述">
    </div>
                </@modal_body>
                <@modal_footer>
        <button class="btn btn-secondary md-close" type="button" data-dismiss="modal">取消</button>
        <button class="btn btn-primary md-close" type="submit">确认</button>
                </@modal_footer>
            </@formNovalidate>
        </@modal>
    </#list>
</@page_body>
<@page_foot>
<script src="/static/lib/parsley/parsley.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function(){
        //initialize the javascript
        var cli = new S7BuyCli();
        cli.init();
        cli.initGoodsGroup();
    });
</script>
</@page_foot>